<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul>
        <li>周星驰</li>
        <li id="gf">功夫</li>
        <li>喜剧之王</li>
        <li>逃学威龙</li>
    </ul>

    <script>
        let gf = document.querySelector('#gf');

        //获取兄弟节点
        console.log(gf.nextSibling);
        console.log(gf.previousSibling);


        //获取兄弟元素节点
        console.log(gf.nextElementSibling);
        console.log(gf.previousElementSibling);
    </script>
</body>

</html>